package com.oneproject.infrastructure.data.unitofwork;

import java.util.Map;

/**
 * 数据库上下文
 *
 * @author 马文韬
 * @Date: 2018/9/12
 * @Version 1.0
 */
public abstract class DbContext {

    private final ModelBuilder builder = new ModelBuilder();

    protected Map<Class<?>, Map<String, Object>> modelMap = null;

    public DbContext() {
    }

    protected void modelCreating() {
        onModelCreating(this.builder);
        modelMap = this.builder.modelMap;
        onModelCreated();
    }

    protected abstract void onModelCreating(ModelBuilder builder);

    protected abstract void onModelCreated();
}
